import type { Config } from "tailwindcss";

// 使用rpx
const uniSpacing: { [k: string]: string } = (() => {
    let result = {};
    // 100以内 间隔是 1
    for (let i = 0; i < 100; i++) {
        result[`${i}`] = `${i * 2}rpx`;
    }
    // 100-400  默认 间隔是 10
    for (let i = 100; i <= 400; i += 10) {
        result[`${i}`] = `${i * 2}rpx`;
    }
    return result;
})();

// ui不处理
const UiLibrary: string[] = ["thorui", "thorui-nvue", "uni", "views"].map((e) => {
    return `!./src/components/${e}/**`;
});
const config: Config = {
    content: ["./index.html", "./src/**/*.{ts,vue}", ...UiLibrary],
    theme: {
        spacing: uniSpacing,
        extend: {
            colors: {
                primary: "rgba(var(--color-primary), <alpha-value>)",
                default: "rgba(var(--color-default), <alpha-value>)",
                remind: "rgba(var(--color-remind), <alpha-value>)",
                tip: "rgba(var(--color-tip), <alpha-value>)",
                price: "rgba(var(--color-price), <alpha-value>)",
                placeholder: "rgba(var(--color-placeholder), <alpha-value>)",
                primaryFill: "rgba(var(--color-primary-fill), <alpha-value>)",
                unSelect: "rgba(var(--color-un-select), <alpha-value>)",
            },

            fontSize: {
                "s-reminder": "var(--font-size-reminder)",
                "s-default": "var(--font-size-default)",
                "s-title": "var(--font-size-title)",
                "s-tip": "var(--font-size-tip)",
            },
            borderRadius: {
                circle: "50%",
            },
        },
    },
    separator: "__", // 兼容小程序，将 : 替换成 __
    plugins: [],
    corePlugins: {
        preflight: false,
        space: false,
        divideColor: false,
        divideOpacity: false,
        divideStyle: false,
        divideWidth: false,
    },
};
export default config;
